Dynomotion

Group: DynoMotion Message: 7385 From: tapiolarikka Date: 4/30/2013
Subject: Re: SpindleMach3Jog - Solved
Hi Tom!

First I want to Thank You for your support in helping to solve this.

I got my spindle under control with following:

#include "KMotionDef.h"

//Plugin Notifications and defines..
enum { EX_DDA , EX_VMS, EX_COMMAND, EX_SPINON, EX_SPINOFF, EX_SPINSPEED, EX_MOTORTUNED
, EX_SETUP, EX_FEEDHOLD, EX_RUN, EX_ESTOP , EX_CONFIG };

#define SPINDLE_AXIS 3 // axis set up as Spindle, possibly Step/Dir or Servo
#define FACTOR 226000.0 // Converts fractional pulley speed to counts/sec (may be negative)

main()
{
int message = persist.UserData[0]; // Mach3 message ID
int Direction = persist.UserData[1]; // Mach3 Spindle Direction
float speed; //= *(float *)&persist.UserData[2]; // value stored is actually a float
int DirFactor = 0;

//if (Direction==0) DirFactor=-1; // change Direcion 0 or 1 to DirFactor -1 or +1
if (Direction==0)
{
DirFactor=-1;
printf("Spindle CW ON\n");
}
else if (Direction==1)
{
DirFactor=1;
printf("Spindle CCW ON\n");
}

printf("Mach3 Notify Message=%d, Direction=%2d, Spindle Set to %f\n",message,Direction,speed);

switch (message)
{
case EX_SPINSPEED:
DefineCoordSystem6(0,1,2,-1,-1,-1);
speed = *(float *)&persist.UserData[2]; // value stored is actually a float
printf("Spindle Speed Set to %f\n",speed);
Jog(SPINDLE_AXIS,speed*FACTOR*DirFactor);
while (!CheckDone(SPINDLE_AXIS));
break;

case EX_SPINON:

if (Direction==0)
{
DirFactor=-1;
printf("Spindle CW ON\n");
}
else if (Direction==1)
{
DirFactor=1;
printf("Spindle CCW ON\n");
}
//Jog(SPINDLE_AXIS,speed*FACTOR*DirFactor);
break;

case EX_SPINOFF:
printf("Spindle Stop\n");
DirFactor=0;
Jog(SPINDLE_AXIS,0.0);
while(!CheckDone(SPINDLE_AXIS));
DefineCoordSystem6(0,1,2,3,-1,-1);
break;
}
Jog(SPINDLE_AXIS,speed*FACTOR*DirFactor);
while(!CheckDone(SPINDLE_AXIS));

}

It may well be that this is not the most elegant solution but it works:

-Spindle speed and speed changes on the fly OK
-Both M3/CW and M4/CCW OK
-Manual Jogging OK
-controlled motion (G0 A90 etc.) OK

Only small beauty flaw is that if I enter spindle speed manually after Mach startup the spindle will start without activating the EX_SPINON. I need to set the rpm to 0 to stop the spindle and click spindle start twice. After that it works.

I see Steve is also struggling with the mach spindle. I don't know if this helps, but it's one possible solution.

Rgds,
Tapio

--- In DynoMotion@yahoogroups.com, "tapiolarikka" <tapio.larikka@...> wrote:
>
> Hi Tom!
>
> So this means then that for some reason the Jog(SPINDLE_AXIS,speed*FACTOR*DirFactor);
> in my code below does not get properly updated.
>
> I'll have to try to rearrange the code.
> Then this also means there should be no problems with lathe constant speed once I got this working.
>
> Rgds,
> Tapio
>
> --- In DynoMotion@yahoogroups.com, Tom Kerekes <tk@> wrote:
> >
> > Hi Tapio,
> >
> > No.  Every time the GCode changes the speed Mach3 will send a message to the Plugin to re-launch the Spindle Program with the new settings.  You should be able to change the Spindle Speed whenever you want from GCode.
> >
> >
> > Regards
> > TK
> >
> >
> >
> > ________________________________
> > From: tapiolarikka <tapio.larikka@>
> > To: DynoMotion@yahoogroups.com
> > Sent: Monday, April 29, 2013 12:10 PM
> > Subject: [DynoMotion] Re: SpindleMach3Jog
> >
> >
> >
> >  
> > Hi Tom!
> >
> > I'll try that tomorrow to find out if it helps to changing spindle speed. That will make me lose the spindle as A-axis so it is not a final solution.
> >
> > I just read your answer to Steve regarding mach spindle&messages a few posts back. You wrote that activation, direction and speed is written to Kflop before C program is launched.
> > Does this mean speed is written only once and therefore not updated if there is change in G-code?
> >
> > Is there a way that I could add the spindle routine to he WatchEnable loop at the end of init?
> >
> > Rgds,
> > Tapio
> >
> > --- In DynoMotion@yahoogroups.com, Tom Kerekes <tk@> wrote:
> > >
> > > Hi Tapio,
> > >
> > > I think the problem has to do with you defining the Spindle to operate like an A axis and to be part of the Coordinated Motion System, and then commanding it to Jog like a normal Spindle.
> > >
> > > Try removing the function calls:
> > >
> > > DefineCoordSystem6(0,1,2,-1,-1,-1);
> > >
> > > DefineCoordSystem6(0,1,2,3,-1,-1);
> > >
> > >
> > > and only add
> > >
> > > DefineCoordSystem6(0,1,2,-1,-1,-1);
> > >
> > > to your initialization program to keep the Spindle always out of the Coordinated Motion System.
> > >
> > > HTH
> > >
> > > Regards
> > > TK
> > >
> > >
> > >
> > >
> > >
> > > ________________________________
> > > From: tapiolarikka <tapio.larikka@>
> > > To: DynoMotion@yahoogroups.com
> > > Sent: Monday, April 29, 2013 7:29 AM
> > > Subject: [DynoMotion] Re: SpindleMach3Jog
> > >
> > >
> > >
> > >  
> > > Hi Tom!
> > >
> > > I'm almost done with my spindle setup.
> > >
> > > I rewrote the SpindleMach3Jog to:
> > >
> > > #define FACTOR 226000.0 // Converts fractional pulley speed to counts/sec (may be negative)
> > >
> > > main()
> > > {
> > > int message = persist.UserData[0]; // Mach3 message ID
> > > int Direction = persist.UserData[1]; // Mach3 Spindle Direction
> > > float speed; //= *(float *)&persist.UserData[2]; // value stored is actually a float
> > > int DirFactor = 0;
> > >
> > > //if (Direction==0) DirFactor=-1; // change Direcion 0 or 1 to DirFactor -1 or +1
> > >
> > >
> > > printf("Mach3 Notify Message=%d, Direction=%2d, Spindle Set to %f\n",message,Direction,speed);
> > >
> > > switch (message)
> > > {
> > > case EX_SPINSPEED:
> > > speed = *(float *)&persist.UserData[2]; // value stored is actually a float
> > > printf("Spindle Speed Set to %f\n",speed);
> > > break;
> > >
> > > case EX_SPINON:
> > > DefineCoordSystem6(0,1,2,-1,-1,-1);
> > >
> > > if (Direction==0)
> > > {
> > > DirFactor=-1;
> > > printf("Spindle CW ON\n");
> > > }
> > > else if (Direction==1)
> > > {
> > > DirFactor=1;
> > > printf("Spindle CCW ON\n");
> > > }
> > > break;
> > >
> > > case EX_SPINOFF:
> > > printf("Spindle Stop\n");
> > > DirFactor=0;
> > > Jog(SPINDLE_AXIS,0.0);
> > > while(!CheckDone(3));
> > > DefineCoordSystem6(0,1,2,3,-1,-1);
> > > break;
> > > }
> > > Jog(SPINDLE_AXIS,speed*FACTOR*DirFactor);
> > >
> > > }
> > >
> > > and now start/stop works like it should.
> > >
> > > Last problem to solve with spindle is speed change:
> > >
> > > G95
> > > S200 f0.06
> > > M3
> > > g1 x10
> > > g1 x0
> > > M5
> > > M30
> > >
> > > works fine, but
> > >
> > > G95
> > > S200 f0.06
> > > M3
> > > g1 x10
> > > S400
> > > g1 x0
> > > M5
> > > M30
> > >
> > > Runs fine until x10, then spindle stops, program execution continues until x0 and at x0 mach resets and indicates "a-axis disabled"
> > >
> > > Is there something missing from my SpindleMach3Jog.c that causes this?
> > > in other words How do I change Spindle speed on-the-fly?
> > >
> > > Rgds,
> > > Tapio
> > > --- In DynoMotion@yahoogroups.com, Tom Kerekes <tk@> wrote:
> > > >
> > > > Hi Tapio,
> > > >
> > > > The Plugin needs the quadrature counts/rev (4 x the cycles/rev) set correctly to have Mach3 report the speed correctly.
> > > >
> > > > Get that to work first.  If one obvious thing is not working it just adds confusion to go on to the next thing.
> > > >
> > > > Do simple tests to check your resolution. Rotate the Spindle 1 rev and check how much the Axis Screen shows that the counts changed.
> > > >
> > > > Enter that value into the Mach3 Plugin for the encoder.  The displayed speed should then report correctly the true speed.
> > > >
> > > >
> > > > Regards
> > > > TK
> > > >
> > > >
> > > >
> > > > ________________________________
> > > > From: tapiolarikka <tapio.larikka@>
> > > > To: DynoMotion@yahoogroups.com
> > > > Sent: Sunday, April 28, 2013 11:01 AM
> > > > Subject: [DynoMotion] SpindleMach3Jog
> > > >
> > > >
> > > >
> > > >  
> > > > Hi Tom!
> > > >
> > > > I broke the questions in my previous post under separate topics, so here is the second question.
> > > >
> > > > I'd be interested to hear from people using SpindleMach3Jog if you had similar issues and how you solved them?
> > > >
> > > > What should be entered in the plugin config for encoder counts? Encoder ppr or ppr*4?
> > > >
> > > > With 2560 counts/rev and following code:
> > > >
> > > > #include "KMotionDef.h"
> > > >
> > > > //Plugin Notifications and defines..
> > > > enum { EX_DDA , EX_VMS, EX_COMMAND, EX_SPINON, EX_SPINOFF, EX_SPINSPEED, EX_MOTORTUNED
> > > > , EX_SETUP, EX_FEEDHOLD, EX_RUN, EX_ESTOP , EX_CONFIG };
> > > >
> > > > #define SPINDLE_AXIS 3 // axis set up as Spindle, possibly Step/Dir or Servo
> > > > #define FACTOR 10240.0 // Converts fractional pulley speed to counts/sec (may be negative)
> > > >
> > > > main()
> > > > {
> > > > int message = persist.UserData[0]; // Mach3 message ID
> > > > int Direction = persist.UserData[1]; // Mach3 Spindle Direction
> > > > float speed = *(float *)&persist.UserData[2]; // value stored is actually a float
> > > > int DirFactor = 1;
> > > >
> > > > if (Direction==0) DirFactor=-1; // change Direcion 0 or 1 to DirFactor -1 or +1
> > > >
> > > >
> > > > printf("Mach3 Notify Message=%d, Direction=%2d, Spindle Set to %f\n",message,Direction,speed);
> > > >
> > > > switch (message)
> > > > {
> > > > case EX_SPINSPEED:
> > > > printf("Spindle Speed Set to %f\n",speed);
> > > > Jog(SPINDLE_AXIS,speed*FACTOR*DirFactor);
> > > > break;
> > > > :
> > > > :
> > > >
> > > > I get movement that starts as soon as enter the rpm and press enter and continues until rpm is set to 0.
> > > > With requested 200rpm the true output is 100 rpm, but mach reports something around 1500 (can't remember exactly).
> > > > If I start the movement from G-Code/M3 the G-code execution hangs.
> > > > Start/accel and stop/decel of movement are nice, as they should.
> > > >
> > > > I changed the above to:
> > > >
> > > > :
> > > > :
> > > > case EX_SPINSPEED:
> > > > printf("Spindle Speed Set to %f\n",speed);
> > > > break;
> > > >
> > > > case EX_SPINON:
> > > > Jog(SPINDLE_AXIS,speed*FACTOR*DirFactor);
> > > > break;
> > > > :
> > > > :
> > > >
> > > > with this I get
> > > > movement that starts when I press spindle start.
> > > > With requested 200rpm the true output is 100 rpm, but mach report something around 1500 (can't remember exactly).
> > > > If I start the movement from G-Code/M3 the G-code execution hangs.
> > > > Start/accel and stop/decel of movement are very rough, with short delay and vibration/jerk like the servo is about to brake into oscillation.
> > > >
> > > > How could I get around this?
> > > >
> > > > Rgds,
> > > > Tapio
> > > >
> > >
> >
>
Group: DynoMotion Message: 7419 From: Steve Date: 5/3/2013
Subject: Re: SpindleMach3Jog - Solved
Take a look in my thread on this topic. At Tom's request I have posted my program which should solve your problem as well.
- Steve

--- In DynoMotion@yahoogroups.com, "tapiolarikka" <tapio.larikka@...> wrote:
>
> Hi Tom!
>
> First I want to Thank You for your support in helping to solve this.
>
> I got my spindle under control with following:
>
> #include "KMotionDef.h"
>
> //Plugin Notifications and defines..
> enum { EX_DDA , EX_VMS, EX_COMMAND, EX_SPINON, EX_SPINOFF, EX_SPINSPEED, EX_MOTORTUNED
> , EX_SETUP, EX_FEEDHOLD, EX_RUN, EX_ESTOP , EX_CONFIG };
>
> #define SPINDLE_AXIS 3 // axis set up as Spindle, possibly Step/Dir or Servo
> #define FACTOR 226000.0 // Converts fractional pulley speed to counts/sec (may be negative)
>
> main()
> {
> int message = persist.UserData[0]; // Mach3 message ID
> int Direction = persist.UserData[1]; // Mach3 Spindle Direction
> float speed; //= *(float *)&persist.UserData[2]; // value stored is actually a float
> int DirFactor = 0;
>
> //if (Direction==0) DirFactor=-1; // change Direcion 0 or 1 to DirFactor -1 or +1
> if (Direction==0)
> {
> DirFactor=-1;
> printf("Spindle CW ON\n");
> }
> else if (Direction==1)
> {
> DirFactor=1;
> printf("Spindle CCW ON\n");
> }
>
> printf("Mach3 Notify Message=%d, Direction=%2d, Spindle Set to %f\n",message,Direction,speed);
>
> switch (message)
> {
> case EX_SPINSPEED:
> DefineCoordSystem6(0,1,2,-1,-1,-1);
> speed = *(float *)&persist.UserData[2]; // value stored is actually a float
> printf("Spindle Speed Set to %f\n",speed);
> Jog(SPINDLE_AXIS,speed*FACTOR*DirFactor);
> while (!CheckDone(SPINDLE_AXIS));
> break;
>
> case EX_SPINON:
>
> if (Direction==0)
> {
> DirFactor=-1;
> printf("Spindle CW ON\n");
> }
> else if (Direction==1)
> {
> DirFactor=1;
> printf("Spindle CCW ON\n");
> }
> //Jog(SPINDLE_AXIS,speed*FACTOR*DirFactor);
> break;
>
> case EX_SPINOFF:
> printf("Spindle Stop\n");
> DirFactor=0;
> Jog(SPINDLE_AXIS,0.0);
> while(!CheckDone(SPINDLE_AXIS));
> DefineCoordSystem6(0,1,2,3,-1,-1);
> break;
> }
> Jog(SPINDLE_AXIS,speed*FACTOR*DirFactor);
> while(!CheckDone(SPINDLE_AXIS));
>
> }
>
> It may well be that this is not the most elegant solution but it works:
>
> -Spindle speed and speed changes on the fly OK
> -Both M3/CW and M4/CCW OK
> -Manual Jogging OK
> -controlled motion (G0 A90 etc.) OK
>
> Only small beauty flaw is that if I enter spindle speed manually after Mach startup the spindle will start without activating the EX_SPINON. I need to set the rpm to 0 to stop the spindle and click spindle start twice. After that it works.
>
> I see Steve is also struggling with the mach spindle. I don't know if this helps, but it's one possible solution.
>
> Rgds,
> Tapio
>
> --- In DynoMotion@yahoogroups.com, "tapiolarikka" <tapio.larikka@> wrote:
> >
> > Hi Tom!
> >
> > So this means then that for some reason the Jog(SPINDLE_AXIS,speed*FACTOR*DirFactor);
> > in my code below does not get properly updated.
> >
> > I'll have to try to rearrange the code.
> > Then this also means there should be no problems with lathe constant speed once I got this working.
> >
> > Rgds,
> > Tapio
> >
> > --- In DynoMotion@yahoogroups.com, Tom Kerekes <tk@> wrote:
> > >
> > > Hi Tapio,
> > >
> > > No.  Every time the GCode changes the speed Mach3 will send a message to the Plugin to re-launch the Spindle Program with the new settings.  You should be able to change the Spindle Speed whenever you want from GCode.
> > >
> > >
> > > Regards
> > > TK
> > >
> > >
> > >
> > > ________________________________
> > > From: tapiolarikka <tapio.larikka@>
> > > To: DynoMotion@yahoogroups.com
> > > Sent: Monday, April 29, 2013 12:10 PM
> > > Subject: [DynoMotion] Re: SpindleMach3Jog
> > >
> > >
> > >
> > >  
> > > Hi Tom!
> > >
> > > I'll try that tomorrow to find out if it helps to changing spindle speed. That will make me lose the spindle as A-axis so it is not a final solution.
> > >
> > > I just read your answer to Steve regarding mach spindle&messages a few posts back. You wrote that activation, direction and speed is written to Kflop before C program is launched.
> > > Does this mean speed is written only once and therefore not updated if there is change in G-code?
> > >
> > > Is there a way that I could add the spindle routine to he WatchEnable loop at the end of init?
> > >
> > > Rgds,
> > > Tapio
> > >
> > > --- In DynoMotion@yahoogroups.com, Tom Kerekes <tk@> wrote:
> > > >
> > > > Hi Tapio,
> > > >
> > > > I think the problem has to do with you defining the Spindle to operate like an A axis and to be part of the Coordinated Motion System, and then commanding it to Jog like a normal Spindle.
> > > >
> > > > Try removing the function calls:
> > > >
> > > > DefineCoordSystem6(0,1,2,-1,-1,-1);
> > > >
> > > > DefineCoordSystem6(0,1,2,3,-1,-1);
> > > >
> > > >
> > > > and only add
> > > >
> > > > DefineCoordSystem6(0,1,2,-1,-1,-1);
> > > >
> > > > to your initialization program to keep the Spindle always out of the Coordinated Motion System.
> > > >
> > > > HTH
> > > >
> > > > Regards
> > > > TK
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > ________________________________
> > > > From: tapiolarikka <tapio.larikka@>
> > > > To: DynoMotion@yahoogroups.com
> > > > Sent: Monday, April 29, 2013 7:29 AM
> > > > Subject: [DynoMotion] Re: SpindleMach3Jog
> > > >
> > > >
> > > >
> > > >  
> > > > Hi Tom!
> > > >
> > > > I'm almost done with my spindle setup.
> > > >
> > > > I rewrote the SpindleMach3Jog to:
> > > >
> > > > #define FACTOR 226000.0 // Converts fractional pulley speed to counts/sec (may be negative)
> > > >
> > > > main()
> > > > {
> > > > int message = persist.UserData[0]; // Mach3 message ID
> > > > int Direction = persist.UserData[1]; // Mach3 Spindle Direction
> > > > float speed; //= *(float *)&persist.UserData[2]; // value stored is actually a float
> > > > int DirFactor = 0;
> > > >
> > > > //if (Direction==0) DirFactor=-1; // change Direcion 0 or 1 to DirFactor -1 or +1
> > > >
> > > >
> > > > printf("Mach3 Notify Message=%d, Direction=%2d, Spindle Set to %f\n",message,Direction,speed);
> > > >
> > > > switch (message)
> > > > {
> > > > case EX_SPINSPEED:
> > > > speed = *(float *)&persist.UserData[2]; // value stored is actually a float
> > > > printf("Spindle Speed Set to %f\n",speed);
> > > > break;
> > > >
> > > > case EX_SPINON:
> > > > DefineCoordSystem6(0,1,2,-1,-1,-1);
> > > >
> > > > if (Direction==0)
> > > > {
> > > > DirFactor=-1;
> > > > printf("Spindle CW ON\n");
> > > > }
> > > > else if (Direction==1)
> > > > {
> > > > DirFactor=1;
> > > > printf("Spindle CCW ON\n");
> > > > }
> > > > break;
> > > >
> > > > case EX_SPINOFF:
> > > > printf("Spindle Stop\n");
> > > > DirFactor=0;
> > > > Jog(SPINDLE_AXIS,0.0);
> > > > while(!CheckDone(3));
> > > > DefineCoordSystem6(0,1,2,3,-1,-1);
> > > > break;
> > > > }
> > > > Jog(SPINDLE_AXIS,speed*FACTOR*DirFactor);
> > > >
> > > > }
> > > >
> > > > and now start/stop works like it should.
> > > >
> > > > Last problem to solve with spindle is speed change:
> > > >
> > > > G95
> > > > S200 f0.06
> > > > M3
> > > > g1 x10
> > > > g1 x0
> > > > M5
> > > > M30
> > > >
> > > > works fine, but
> > > >
> > > > G95
> > > > S200 f0.06
> > > > M3
> > > > g1 x10
> > > > S400
> > > > g1 x0
> > > > M5
> > > > M30
> > > >
> > > > Runs fine until x10, then spindle stops, program execution continues until x0 and at x0 mach resets and indicates "a-axis disabled"
> > > >
> > > > Is there something missing from my SpindleMach3Jog.c that causes this?
> > > > in other words How do I change Spindle speed on-the-fly?
> > > >
> > > > Rgds,
> > > > Tapio
> > > > --- In DynoMotion@yahoogroups.com, Tom Kerekes <tk@> wrote:
> > > > >
> > > > > Hi Tapio,
> > > > >
> > > > > The Plugin needs the quadrature counts/rev (4 x the cycles/rev) set correctly to have Mach3 report the speed correctly.
> > > > >
> > > > > Get that to work first.  If one obvious thing is not working it just adds confusion to go on to the next thing.
> > > > >
> > > > > Do simple tests to check your resolution. Rotate the Spindle 1 rev and check how much the Axis Screen shows that the counts changed.
> > > > >
> > > > > Enter that value into the Mach3 Plugin for the encoder.  The displayed speed should then report correctly the true speed.
> > > > >
> > > > >
> > > > > Regards
> > > > > TK
> > > > >
> > > > >
> > > > >
> > > > > ________________________________
> > > > > From: tapiolarikka <tapio.larikka@>
> > > > > To: DynoMotion@yahoogroups.com
> > > > > Sent: Sunday, April 28, 2013 11:01 AM
> > > > > Subject: [DynoMotion] SpindleMach3Jog
> > > > >
> > > > >
> > > > >
> > > > >  
> > > > > Hi Tom!
> > > > >
> > > > > I broke the questions in my previous post under separate topics, so here is the second question.
> > > > >
> > > > > I'd be interested to hear from people using SpindleMach3Jog if you had similar issues and how you solved them?
> > > > >
> > > > > What should be entered in the plugin config for encoder counts? Encoder ppr or ppr*4?
> > > > >
> > > > > With 2560 counts/rev and following code:
> > > > >
> > > > > #include "KMotionDef.h"
> > > > >
> > > > > //Plugin Notifications and defines..
> > > > > enum { EX_DDA , EX_VMS, EX_COMMAND, EX_SPINON, EX_SPINOFF, EX_SPINSPEED, EX_MOTORTUNED
> > > > > , EX_SETUP, EX_FEEDHOLD, EX_RUN, EX_ESTOP , EX_CONFIG };
> > > > >
> > > > > #define SPINDLE_AXIS 3 // axis set up as Spindle, possibly Step/Dir or Servo
> > > > > #define FACTOR 10240.0 // Converts fractional pulley speed to counts/sec (may be negative)
> > > > >
> > > > > main()
> > > > > {
> > > > > int message = persist.UserData[0]; // Mach3 message ID
> > > > > int Direction = persist.UserData[1]; // Mach3 Spindle Direction
> > > > > float speed = *(float *)&persist.UserData[2]; // value stored is actually a float
> > > > > int DirFactor = 1;
> > > > >
> > > > > if (Direction==0) DirFactor=-1; // change Direcion 0 or 1 to DirFactor -1 or +1
> > > > >
> > > > >
> > > > > printf("Mach3 Notify Message=%d, Direction=%2d, Spindle Set to %f\n",message,Direction,speed);
> > > > >
> > > > > switch (message)
> > > > > {
> > > > > case EX_SPINSPEED:
> > > > > printf("Spindle Speed Set to %f\n",speed);
> > > > > Jog(SPINDLE_AXIS,speed*FACTOR*DirFactor);
> > > > > break;
> > > > > :
> > > > > :
> > > > >
> > > > > I get movement that starts as soon as enter the rpm and press enter and continues until rpm is set to 0.
> > > > > With requested 200rpm the true output is 100 rpm, but mach reports something around 1500 (can't remember exactly).
> > > > > If I start the movement from G-Code/M3 the G-code execution hangs.
> > > > > Start/accel and stop/decel of movement are nice, as they should.
> > > > >
> > > > > I changed the above to:
> > > > >
> > > > > :
> > > > > :
> > > > > case EX_SPINSPEED:
> > > > > printf("Spindle Speed Set to %f\n",speed);
> > > > > break;
> > > > >
> > > > > case EX_SPINON:
> > > > > Jog(SPINDLE_AXIS,speed*FACTOR*DirFactor);
> > > > > break;
> > > > > :
> > > > > :
> > > > >
> > > > > with this I get
> > > > > movement that starts when I press spindle start.
> > > > > With requested 200rpm the true output is 100 rpm, but mach report something around 1500 (can't remember exactly).
> > > > > If I start the movement from G-Code/M3 the G-code execution hangs.
> > > > > Start/accel and stop/decel of movement are very rough, with short delay and vibration/jerk like the servo is about to brake into oscillation.
> > > > >
> > > > > How could I get around this?
> > > > >
> > > > > Rgds,
> > > > > Tapio
> > > > >
> > > >
> > >
> >
>